package com.theory.config;

import com.theory.bind.MapperRegistry;
import com.theory.mapping.MapperStatement;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Configuration {
    protected Environment environment;
    protected final Set<String> loadedNamespaces = new HashSet<>();
    protected final MapperRegistry mapperRegistry = new MapperRegistry();
    protected final Map<String, MapperStatement> mappedStatements = new HashMap<>();

    public Environment getEnvironment() {
        return environment;
    }

    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }

    public boolean hasMapper(Class<?> type){
        return mapperRegistry.hasMapper(type);
    }

    public void registerMapper(Class<?> type){
        mapperRegistry.registerMapper(type);
    }

    public void addNamespace(String namespace){
        loadedNamespaces.add(namespace);
    }

    public void addMapperStatement(MapperStatement mapperStatement){
        mappedStatements.put(mapperStatement.getId(), mapperStatement);
    }

}
